package com.aloha.springframework.aop.framework;

import com.aloha.springframework.aop.AdvisedSupport;
import com.aloha.springframework.utils.ClassUtils;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.List;

/**
 * @author DaiZhiHeng
 * @description 使用JDK的动态代理
 * @date 2023/7/7 9:42
 */
public final class JdkDynamicAopProxy extends AbstractDynamicAopProxy implements AopProxy {


    public JdkDynamicAopProxy(AdvisedSupport advised) {
        super(advised);
    }

    @Override
    public Object getProxy() {
        return Proxy.newProxyInstance(ClassUtils.getDefaultClassLoader(), advised.getTargetSource().getTargetClass(), this);
    }

}
